package knowse.app;

import java.util.ArrayList;
import java.util.Arrays;

public class HeatMapData {
	
    private ArrayList<ArrayList> data;
    private ArrayList<String> labels;
    
	public HeatMapData ()
	{
		//Old stuff
		//float[][] temp = {{0.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f}, 
        //				   {10.0f, 80.0f, 12.0f, 12.0f, 6.0f, 5.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f}, 
        //					{10.0f, 80.0f, 12.0f, 12.0f, 6.0f, 5.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f}};

        //String[] tmpYAxis  = {"KnowSE","TestSE","OtherSE"};
		
        //Setup example labels			
		labels = new ArrayList();
        labels.add("KnowSE");
        labels.add("TestSE");
        labels.add("OtherSE");
        
        //Setup example data
        data = new ArrayList();
        data.add(new ArrayList<Float>(Arrays.asList(0.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f)));  
        data.add(new ArrayList<Float>(Arrays.asList(0.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f)));  
        data.add(new ArrayList<Float>(Arrays.asList(0.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f, 100.0f, 2.0f, 3.0f, 4.0f, 5.0f)));
	}

	public void addRow(String label, float value) {
		//If it is the first time we add data for label
		labels = new ArrayList();
		data = new ArrayList();
		ArrayList tempData;
		if(!labels.contains(label)) {
			labels.add(label);
			tempData = new ArrayList();
			tempData.add(value);
			data.add(tempData);
		} else {
			int index = labels.indexOf(label);
			tempData = data.get(index);
			tempData.add(value);
			data.set(index, tempData);
		}
	}
	
	public ArrayList getData() {
		return data;
	}
	
	public ArrayList getLabels() {
		return labels;
	}
}